package com.jrx.anytxn.reporting.job.xib.step;

import com.jrx.anytxn.reporting.entity.AmlIATrading;
import com.jrx.anytxn.reporting.mapper.base.AmlIATradingMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TradingWriter implements ItemWriter<AmlIATrading> {

    @Resource
    private AmlIATradingMapper amlIATradingMapper;

    @Override
    public void write(List<? extends AmlIATrading> items) throws Exception {
        if(CollectionUtils.isNotEmpty(items)){
            for(AmlIATrading amlIATrading : items){
                amlIATradingMapper.insertSelective(amlIATrading);
            }
        }

    }
}
